cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(test_aligner)
# 递归包含头文件的函数
function(include_sub_directories_recursively root_dir)
    file(GLOB ALL_SUB RELATIVE ${root_dir} ${root_dir}/*) # 获得当前目录下的所有文件，加入ALL_SUB列表中
    foreach(sub ${ALL_SUB})
        if (IS_DIRECTORY ${root_dir}/${sub})# 子路径是一个目录
            if (${sub} MATCHES "include")
                message("include dir: " ${root_dir}/${sub})
                include_directories(AFTER ${root_dir}/${sub})
            elseif(NOT ((${sub} MATCHES "\\.") OR (${sub} MATCHES "build")))
                include_sub_directories_recursively(${root_dir}/${sub}) # 对子目录递归调用，包含
            endif()
        endif()
    endforeach()
endfunction()

set(CMAKE_BUILD_TYPE Release)
# find_package(PCL 1.2 REQUIRED)
# include_directories(BEFORE ${PCL_INCLUDE_DIRS})
# link_directories(BEFORE ${PCL_LIBRARY_DIRS})
# add_definitions(${PCL_DEFINITIONS})

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/fast_gicp)

add_executable (test_aligner test_aligner.cpp)
target_link_libraries (test_aligner ${PCL_LIBRARIES} fast_gicp)
target_compile_features(test_aligner PUBLIC cxx_std_17)